var assert =require('assert')

//assert.strictEqual(1,2)

const set = new Set();
var arrs = [2,3,4,5,2,3,4,5];
[2,3,4,5,2,3,4,5].forEach(i=>set.add(i))
console.log("set is ",set)
console.log("set is ",set.size)
console.log("set is ",set.has(2))
console.log("set is ",set.delete(2))
console.log("set is ",set.has(2))
console.log("set is ",set.delete(2))

 var cc=Array.from(new Set([2,3,4,5,2,3,4,5]))
console.log(cc)

for (let i of set ){
    console.log(i)
}
set.forEach((value,key,sets)=>console.log(key,"ccc",value,"bbb",sets))

 var  arrset =   new Set(arrs)
     console.log([...arrset]);
       cccc= new Set([...arrset].map(x=>x*2))
console.log(cccc)
console.log([...arrset]);
var dddd = new Set([...arrset].filter(x=>(x%2)==0))
console.log(dddd)

var eeee = new Set([...arrset].filter(y =>{
  return y>=4
} ))
console.log(eeee)
console.log("===========ccccccccc=========")


const maps = new Map()

const items = [
    ['name','张三'],
    ['title','author']
]

items.forEach((key,value,idx)=>{
    maps.set(key,value)
    console.log(key)
    console.log(value)
    console.log(idx)
})


//maps.add(mpa1)
console.log(maps)
console.log(maps.size)
console.log(maps.has('name'))


const mapcc = new Map([
    ['name', '张三'],
    ['title', 'Author']
]);
console.log(mapcc.has('name'))
console.log(mapcc)

const mapdd = new Map(items);
console.log(mapdd.has('name'))
console.log(mapdd)

for (i of mapdd.keys()) {
    console.log(i)
}
for (i of mapdd.values()){
    console.log(i)
}
for (i of mapdd.entries()){
    console.log(i)
}

for ([x,y] of mapdd.entries()){
    console.log(x,y)
}

const mpa1 = {
    p:"hello world",

}

const {p1:xxx=555,p:yyy} = mpa1;
console.log("p is",xxx)
console.log("p is",yyy)

for (let csd of Object.keys(mpa1)){
    console.log(csd)
}


